#! /usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
#  * Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#  * Redistributions in binary form must reproduce the above
#    copyright notice, this list of conditions and the following
#    disclaimer in the documentation and/or other materials provided
#    with the distribution.
#  * Neither the name of Willow Garage, Inc. nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.


PACKAGE='dynamic_reconfigure_test'

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()
gen.const("int_const", int_t, 5, "An int constant.")
gen.const("double_const", double_t, 5.6, "A double constant.")
gen.const("str_const", str_t, "foo", "A string constant.")
gen.const("bool_const", bool_t, True, "A bool constant.")

enum = gen.enum([ gen.const("Small", int_t, 0, "A small constant"),
gen.const("Medium", int_t, 1, "A medium value"),
gen.const("Large", int_t, 2, "A large value"),
gen.const("ExtraLarge", int_t, 3, "An extra large value") ], "An enum to set the size.")

gen.add("int_enum_", int_t, 1, "Int enum",0, 0, 3, edit_method = enum)
gen.add("int_", int_t, 1, "Int parameter",0, -10, 10)
gen.add("double_", double_t, 2, "double parameter", 0, -2, 10)
gen.add("double_no_minmax", double_t, 2, "double parameter without boundaries", 1)
gen.add("double_no_max", double_t, 2, "double parameter without max value", 2, 0)
gen.add("str_", str_t, 4, "String parameter","foo")
gen.add("mstr_", str_t, 4, "Multibyte String parameter","bar")
gen.add("bool_", bool_t, 8, "Boolean parameter",False)
gen.add("level", int_t, 16, "Contains the level of the previous change",0)
gen.add("int_nodefault", int_t, 0, "Checks against regression of #4499")
gen.add("i", int_t, 0, "Checks against regression of https://github.com/ros/dynamic_reconfigure/issues/6")

group1 = gen.add_group("Group One", state = True)
group1.add("group1_int", int_t, 1, "A second level group parameter", 2)
group2 = group1.add_group("GROUP2", type="collapse", state=False)
group2.add("group2_double", double_t, 0, "A third level group parameter", 3.333)
group2.add("group2_string", str_t, 0, "A third level group parameter", "test string")
group2.add("some_other", str_t, 0, "Something", "AAAAAAGGHH")
group2.add("variable", bool_t,0, "A boolean", True)
group3 = group2.add_group("Group3")
group3.add("deep_var_int", int_t, 0, "Were very far down now", 0, 0, 3, edit_method = enum)
group3.add("deep_var_bool", bool_t, 0, "Were even farther down now!!", True)
group3.add("deep_var_double", double_t, 0, "Were super far down now!!", -1.0)

group12 = gen.add_group("Upper Group 2")
group12.add("some_param", int_t, 0, "Some param", 20)

exit(gen.generate(PACKAGE, "test_reconfigure_server_cpp", "Test"))
